home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Scene 96
/
Scene 96 International Edition (Zyklop Software) (Disc 2) (1997).iso
/
misc
/
coding
/
e_os208
/
resource
/
eos.us
< prev
next >
Wrap
Text File
|
1996-07-30
|
28KB
|
851 lines
───────────────────────────────────────────────────────────────────────────────
E.O.S. Eclipse Operating System Version 2.08 Documentation
Copyright (c) Eclipse 1995-96
───────────────────────────────────────────────────────────────────────────────
__
/\_\ _______
_______ / / / / ___ /\
/ _____/\ / / / / /\_/ / /
/ /\____\/______ / / / __ / _____/ /_______
/ _____/\ /\ ___\ / /_/ /\ \ / /\____\//\ ____\
/ /\____\/ \ \ \__/ \ \ \ \ \ \ /_/ / \ \ \___/_
/______/\ \ \ \____\ \_\ \ \ \\_\/_______ \ \ ____\
\______\/ \ \_____\\/_/ \ \_\ /\ ____\ \ \ \___/_
\/_____/ \/_/ \ \ \___/_ \ \______\
\ \_____ \ \/______/
\/_____\ \
/\______\
\/______/
───────────────────────────────────────────────────────────────────────────────
Presentation of E.O.S modules
───────────────────────────────────────────────────────────────────────────────
E.O.S is made of many files.
Basic Objects :
■ KERNEL.OBJ System Kernel.
■ DIAMOND.OBJ 32 Channels modules player.
■ EOS.OBJ E.O.S works with Diamond player.
■ EOSLITE.OBJ E.O.S works without Diamond player.
■ DEBUG.OBJ 32 bits Debugger
■ EOS.INC Include File.
Library :
■ VESA.OBJ To acces directly the graphic card buffer.
without taking care of the bank changes in VESA.
■ FLI32.OBJ FLI/FLC player.
■ SNAP.OBJ For the 256 colours screen grab in the IFF format.
■ JOYSTICK.OBJ for the joysticks management.
Utilities :
■ Light Link To create a single compressed file.
■ Crypt To protect your datas.
■ Scancode To display the keyboard codes.
■ 132 To go in 132 columns mode.
■ 90 To go in 90 columns mode.
■ Edconfig To configure the debugger.
■ Diet To compress your datas.
───────────────────────────────────────────────────────────────────────────────
Memory management with E.O.S
───────────────────────────────────────────────────────────────────────────────
With E.O.S, the memory problems are over! You can now linear adress
all the available memory and that with any system configuration.
■ RAW mode without Himem.
■ XMS mode with Himem.
■ VCPI mode with EMS (Emm386 highscan).
■ VCPI mode without EMS (Emm386 noems).
■ DPMI mode with Windows 3.1x (with some restrictions *).
■ DPMI mode with Windows 95.
■ DPMI mode with OS/2 2.1 or OS/2 Warp.
* See compatibility with Windows.
You can allocate or free hi memory with a simple E.O.S interrupt.
Allocation :
mov ah,Allocate_Memory
mov edx,Size_Allocation
Int_EOS
jc Not_Enough_Memory
mov [Logical_Address_Of_Block],edx
Retrieval of the last allocation :
mov ah,DeAllocate_Memory
Int_EOS
You can with the same simplicity create your own selectors and fully take
advantadge of the protected mode granularity.
Allocation of a selector :
mov ah,Allocate_Selector
mov esi,0a0000h ; base
mov edi,0ffffh ; size
Int_EOS
jc No_Free Selector
mov [_0a0000h_Sel],bx
Retrieval of a selector :
mov ah,DeAllocate_Selector
mov bx,[_0a0000h_Sel]
Int_EOS
jc Invalid_Selector
───────────────────────────────────────────────────────────────────────────────
Files management with E.O.S
───────────────────────────────────────────────────────────────────────────────
Load a file in memory isn't more difficult.
External file loading :
mov ah,Load_External_File
mov edx,offset File_name
Int_EOS
jc Error_File
mov File_Buffer,eax
LightLinked Linked file loading (Lightlink:Linker provided
with E.O.S) :
mov ah,Load_Internal_File
mov edx,offset File_name
Int_EOS
mov File_Buffer,eax
The Load_Internal_File function works also if the program is not
linked. E.O.S is able to make out the two cases, witch allows to
develop and test a program without having linked the datas.
More, if your file is LZ-packed with a program like Diet 1.44,
E.O.S will unpack it automatically !
Write a file to disk isn't more difficult than Load :
mov ah,Write_External_File
mov edx,O File_name
mov esi,[Buffer]
mov ecx,[Size_Buffer]
Int_EOS
jc Error_File
───────────────────────────────────────────────────────────────────────────────
Sound cards management with E.O.S
───────────────────────────────────────────────────────────────────────────────
The sound cards management wasn't forgotten.
Indeed, E.O.S is ableto play a sample or a .MOD Amiga module (from 2 to 32
voices) without any programming from your part on the seven following cards
■ Sound Blaster
■ Sound Blaster Pro
■ Sound Blaster 16 Asp
■ Sound Blaster AW32
■ Gravis Ultrasound
■ Gravis Ultrasound Max
■ Gravis Ultrasound Ace
Example :
mov ah,Detect_Sound_Card
xor bx,bx
mov cx,1
Int_EOS
mov ah,Load_Module
mov al,4
mov ebx,22000
mov edx,offset Module_name
Int_EOS
jc error_file
mov ah,Play_Module
Int_EOS
Many functions are then available :
Set Volume Set the master volume of the module
Play Sample Play a sample include into the module
Get Info Get information about the module
when playing (i.e:synchro with module)
Set Pattern Set the current position of the
playing module
call Pause
mov ax,4c00h
int 21h
As you see above, you haven't to stop the music or to free the memory
before leaving your program. E.O.S makes it for you.
Every time it encounters the 4c00h function or during
a program plantage bombing, E.O.S will restitute automatically
the start environment :
■ The video mode, including VESA modes (132x60,etc...)
■ The clock time.
■ The interrupts.
■ The allocated memory.
■ Stops the music.
Of course, it is always possible to free the memory and to stop
a module to load another one, like this :
mov ah,Stop_Module
Int_EOS
mov ah,Clear_Module
Int_EOS
If you find an error, use the E.O.S function Exit_Error :
mov ah,Exit_Error
mov edx,Offset Error_Txt
Int_EOS
This function is same as :
mov ah,9 ; Fonction Display String
mov edx,Offset Msg
int 21h
mov ax,4c01h
int 21h
At any time you can restituate the video mode :
mov ah,Restore_Video_Mode
Int_EOS
───────────────────────────────────────────────────────────────────────────────
Management of a second monochrome screen
───────────────────────────────────────────────────────────────────────────────
To make easier you programs debugging , E.O.S provides some basic functions
witch allow to control a second screen via a monochome Hercule-type card.
E.O.S detects automatically your screen. Nevertheless, if it is not
recognized, you can use the following sequence :
mov ah,Set_Mono
mov bx,On
Int_EOS
Many functions are then available like for example
the display of an ASCII characters string or a Hexadecimal value.
Display an ASCII characters string :
mov ah,Set_String_Mono
mov bx,Coordinate X
mov cx,Coordinate Y
mov edx,Offset String_To_Display
Int_EOS
Display a Hexadecimal value :
mov ah,Set_Value_Mono
mov bx,Coordinate X
mov cx,Coordinate Y
mov edx,Value_To_Display
Int_EOS
A macro is also available : Send witch allows a more simple
use of the Set_Value_Mono function.
Send function :
Send Value_To_Display,X,Y
The ASCII string can be terminated either by $ or by the NULL character.
The function also takes the carriage return characters (13 and 10) in consideration .
The hexadecimal values must not exceed 16 Bits.
Attention : for time saving, no test is made for the sreen coordinates.
Note : the Monochrome screen is automatically cleaned at the beginning and
at the ending of a program.
───────────────────────────────────────────────────────────────────────────────
Keyboad management E.O.S
───────────────────────────────────────────────────────────────────────────────
A very simple keyboard management was implanted in E.O.S to be easier for you.
To activate it, you should take the interrupt 09 control like this :
Activating the keyboard management
mov ah,Use_Int_09
mov bx,On
Int_EOS
The keyboard is then entirely managed by E.O.S wich communicates directly
with it. There is no more call to the old DOS manager.
So, the 16h interrupt does not work any more.
The keyboard reading becames very easy with the Key_Map variable.
This variable is in fact a 128 bytes array which squares
with the 128 scancodes sent by the keyboard.
To know a key state you just have to know if its scancode
is 0 or 1 (On or Off).
Example, to test if the space bar is now pressed :
cmp Key_Map[Escape],On
je Escape_Key_Pressed
...
Escape_Key_Pressed:
mov Key_Map[Escape],Off
A special scancode "All" is used to know if a key as been
pressed and then released.
Example, to test if the Escape key has been pressed :
cmp Key_Map[All],Escape
je Escape_Key_Pressed
Which allows to wait a undefined key :
@@Wait_Key:
cmp Key_Map[All],Off
je @@Wait_Key
mov Key_Map[All],Off
It is of course possible to desactivate the keyboard and to come
backe to the old manager.
Keyboard restoring :
mov ah,Use_Int_09
mov bx,Off
Int_EOs
Note : At the program end, E.O.S restitutes all the interrupts.
So,the interrupt 09 restoring is not obligatory.
───────────────────────────────────────────────────────────────────────────────
Synchronisation with the balayage
───────────────────────────────────────────────────────────────────────────────
E.O.S has its own timing system.
Screen retrace control :
mov ah,Wait_Vbl
Int_EOS
Using the interrupt 08 or timer raises the facilities of this function.
As for the keyboard interrupt there is no call to the old managers.
Enabling the timing manager :
mov ah,Use_Int_08
mov bx,On
Int_EOS
Wait_Vbl then sends back the scans number made since the last call.
This function always sends back 1 if the interruption 08 is Off.
Using this interrupt and the Wait_Vbl function, your program
is always able to know how many frames it has loosen.
You dispose of a regular counter very useful for the displacements computing.
Attention : This function is unstable under Windows 3.xx.
When you changing the current video mode, do a synchronization whith
Synchro_Int_08 :
mov ax,13h
DosInt 10h
mov ah,Synchro_Int_08
Int_EOS
A macro is also available : Colors which allows to temporary change
a colour to split each routine of your program.
Colors Function:
colors colour_number,Red_Value,Green_Value,Blue_Value
Example using the scan functions :
@@Loop:
colors 0,63,0,0 ; First colour bright red
call Procedure_1
colors 0,0,63,0 ; Second colour bright green
call Procedure_2
mov ah,Wait_Vbl
Int_EOS
@@Count:
add [Regular_Value],1
dec eax ; Adding regular values
jne @@Count
cmp [Key_Map+All],On
jne @@Loop
───────────────────────────────────────────────────────────────────────────────
E.O.S variables
───────────────────────────────────────────────────────────────────────────────
E.O.S has some global variables which can be necessary every
time during a program execution :
Code32_Sel : Code selector (CS).
----------
Example : Diverting interrupt 70h :
mov ah,Set_Int
mov bx,70h
mov cx,[Code32_Sel] ; Selector
mov edx,O New_Int_70h ; New routine offset
Int_EOS
Attention ! In protected mode you cannot do :
mov cs:[Value],10
This will set off an exception and stop your program.
Data32_Sel : Data selector (DS).
----------
Example using Data32_Sel :
Value dd 0
mov [Value],10
In reality, the Code32_Sel and Data32_Sel selectors are identicals.
The difference is their acces. Code32_Sel is in reading mode when
Data32_Sel is in reading and writing mode.
At a program beginning all the segment registers (except CS) are
set up with a Data32_Sel value.
Zero_Sel : Selector which has the memory zero adress for origin
-------- Very useful to read for example the BIOS variables.
Read the current video mode :
push es
mov es,cs:[Zero_Sel]
mov al,es:[449h] ; 40h:49h in real mode
pop es
Real_DS,Real_ES,Real_FS,Real_GS,Real_SS,Real_SP :
-----------------------------------------------
This variables contain the various segments intended values during
a real mode call (See real mode).
───────────────────────────────────────────────────────────────────────────────
E.O.S macros
───────────────────────────────────────────────────────────────────────────────
E.O.S has macros which allow to simplify the programmation .
Colours macro :
colors colour_number,Red_Value,Green_Value,Blue_Value
(See timing with the scan)
Get_Param:
Get_Param Param_Buffer
...
Param_Buffer db 128 dup (0)
Return the command ligne parameters.
Send macro:
Send Value_To_Display,X,Y
(See management of a second monochrome screen)
DosInt macro:
DosInt interrupt_number
(See real mode)
DosCall macro:
DosCall Real_Mode_Address
(See real mode)
Init_es_di macro:
Init_es_di Offset 32_Bits_Adress
(See real mode)
Init_ds_dx macro:
Init_ds_dx Offset 32_Bits_Adresse
(See real mode)
───────────────────────────────────────────────────────────────────────────────
The include file (EOS.INC)
───────────────────────────────────────────────────────────────────────────────
The include file EOS.INC is the file which allow to do the link between
your program and E.O.S . It contains all the declarations of the E.O.S
various functions,the macros and the variables described in this file.
───────────────────────────────────────────────────────────────────────────────
The real mode
───────────────────────────────────────────────────────────────────────────────
E.O.S allows a link with real mode with macros .
DosInt macro :
DosInt Interruption_Number
This macro allows to call real mode interrupts.
Example :
mov ax,13h ; 320x200 256 colours mode
DosInt 10h ; Calls the BIOS function
; Set Video Mode
DosCall macro :
DosCall Real_Mode_Adress
This macro allows to call real mode functions.
Example :
XMS_Adress dw 0,0
mov ax,4300h ; Function which tests if a
DosInt 2fh ; XMS driver is present
cmp al,80h
je No_XMS_Driver
mov ax,4310h ; If yes, ask its
DosInt 2fh ; enter point
mov [XMS_Adress],bx
mov eax,[Real_ES]
mov [XMS_Adress+2],ax
xor ah,ah ; XMS driver function 0
DosCall Dword Ptr [XMS_Adress] ; Get XMS Version
Init_es_di macro :
Init_es_di 32_Bits_Adress
This macro allows the good displacement of the variables which
will be used for the real mode.
Init_ds_dx macro:
Init_ds_dx 32_Bits_Adress
This macro allows the good displacement of the variables which
will be used for the real mode.
Example :
Vesa_Buffer db 256 dup (0)
Init_es_di Vesa_Buffer
mov ax,4f00h ; Tests the presence of
DosInt 10h ; a VESA driver
cmp dword ptr Vesa_Buffer,'ASEV'
jne no_vesa
Attention ! The parametric adress for the Init_es_di and Init_ds_dx
macros must be under the firts Mega byte.
Real_DS,Real_ES,Real_FS,Real_GS,Real_SS,Real_SP :
-----------------------------------------------
This variables contain the various segments intended values during
a real mode call.
───────────────────────────────────────────────────────────────────────────────
The linker
───────────────────────────────────────────────────────────────────────────────
E.O.S proposes an utility which allows to create a single executable file
(LLINK32.EXE) in a transparent and easy to use way for you.
E.O.S is able to differenciate a linked file and a program without any link.
You will only have to call all the files you want to link with your program
using the Load_Internal_File function, or else you will use the
Load_External_File function . When the program is finished , you just have
to edit a link file and to execute the linker (LLINK32.EXE) without changing
your program code (See Example4 in the EXAMPLE directory).
Example using Load_Internal_File and Load_External_File :
Link_File db 'IMAGE.PIC',0
External_File db 'PRG.CFG',0
mov ah,Load_Internal_File ; Loads a file
mov edx,O Link_File ; to link
Int_EOS ; No possible error,
; they are managed by E.O.S
mov ah,Load_External_File ; Loads an external file
mov edx,O External_File
Int_EOS
jc Error_Loading ; Error reading
Link file contens :
FINAL.EXE ; Name of the executable file
; which will be created
PRG.EXE ; Name of the executable file
; which will be linked
IMAGE.PIC ; Data file which will be linked
:END ; End of file...
Attention ! The files to be linked must be packed with Diet
───────────────────────────────────────────────────────────────────────────────
Interrupts with E.O.S
───────────────────────────────────────────────────────────────────────────────
E.O.S allows to adjust some interrupts without any problem
with the Get_Int and Set_Int functions
Example : Diverting interrupt 70h :
mov ah,Get_Int ; Reads the old vector
mov bx,70h
Int_EOS
mov [Old_Selector_Int_70h],cx
mov [Old_Offset_Int_70h],edx
mov ah,Set_Int
mov bx,70h
mov cx,[Code32_Sel] ; Selector
mov edx,O New_Int_70h ; New routine offset
Int_EOS
E.O.S also gives you a round of functions of the interrupt 21h
which allows a more easy programs management .
This functions are :
Display_String 9h
Make_Directory 39h
Remove_Directory 3ah
Change_Directory 3bh
Create_File 3ch
Open_File 3dh
Close_File 3eh
Read_File 3fh
Write_File 40h
Delete_File 41h
Seek_File 42h
File_Attributes 43h
Get_Directory 47h
Load_and_Execute 4bh
Terminate_Program 4ch
Find_First 4eh
Find_Next 4fh
Rename_File 56h
Create_Temporary_File 5ah
Create_New_File 5bh
So, it becomes easy to call a DOS function
Example : Display a message :
Msg db 'Hello Word',13,10,36
mov ah,9 ; Display_String function
mov edx,Offset Msg
int 21h
mov ax,4c00h
int 21h
Attention ! To end a program you MUST call the interrupt 21h function 4ch.
The E.O.S function Direct_Send Write a text directly to video ram.
Color allowed !
lea edx,Message
mov ah,Direct_Send
Int_EOS
...
Message db " ",0,1,"■ Color Blue ",0,4,"Red ",13,10,0,0
───────────────────────────────────────────────────────────────────────────────
IRQs or material interrupts with l'E.O.S
───────────────────────────────────────────────────────────────────────────────
All IRQs are accessible for your program . On the other hand, E.O.S has
altered its interrupts to prevent the conflicts with the protected mode
exceptions . To use an IRQ, E.O.S gives you two functions to redefine IRQs :
Get_IRQ function :
Function which returns an IRQ adress
Set_IRQ function :
Function which diverts an IRQ on a routine
Use example :
Old_IRQ0 Label Fword
Old_Offset_IRQ0 dd 0
Old_Selector_IRQ0 dw 0
mov ah,Get_IRQ
mov bl,0 ; IRQ timer
Int_EOS
mov [Old_Selector_IRQ0],cx
mov [Old_Offset_IRQ0],edx
mov ah,Set_IRQ
mov bl,0 ; IRQ timer
mov cx,cs
mov edx,Offset New_IRQ0
Int_EOS
...
New_IRQ0:
...
jmp fword ptr cs:[Old_IRQ0]
───────────────────────────────────────────────────────────────────────────────
Exceptions with E.O.S
───────────────────────────────────────────────────────────────────────────────
All the exceptions are managed by E.O.S . If an exception is released,
E.O.S will automatically quit your program . It will restore automatically
the allocated memory, stop the module playing if necessary, restore the
starting video mode, and display an error message.
───────────────────────────────────────────────────────────────────────────────
Compatibility with Windows (tm)
───────────────────────────────────────────────────────────────────────────────
E.O.S is compatible with Windows 3.x (tm) and Windows 95 (tm) . Nevertheless,
because of the privilege level given to your program by Windows (the worst),
You may not use the Use_Int_08 functions and the DIAMOND player if you want
you program to run correctly. Under Windows 95, your program will probably
just slow down, but under Windows 3.x, it can crash windows.
So E.O.S gives you a function which detects the presence of Windows 3.x and
Windows 95 and let you the choice to stop your program or not.
Advice: if your program uses hardware resources, do not make it working
under Windows 3.x .
Detect_Windows function :
This function returns if Windows is present
Use Example :
mov ah,Detect_Windows
Int_EOS
test al,al
je No_Windows
cmp al,3
je Found_Windows_3
cmp al,4
je Found_Windows_95
Found_Windows_96:
───────────────────────────────────────────────────────────────────────────────
The debugger
───────────────────────────────────────────────────────────────────────────────
The debugger is an external object file which you just have to include
for the linkage and to call in your program: CALL DEBUG (See example6).
The debugger facilities are the sames as in Borland Turbo Debug 2.01 .
The main functions in the debugger are :
- The 487 coprocessor instructions
- The opcodes in front of each instruction
- Supporting a monochrome screen
An utility is also provided in order to configurate the debugger (EDCONFIG.EXE
available in the RESOURCE directory). It allows to change the colours of the
debugger and to choose the default screen . For more informations, type :
EDCONFIG -h to obtain the in-line help.